﻿using System;
using System.Xml.Serialization;
using PSE.Deployment.SetupBase.Configuration.Enums;

namespace PSE.Deployment.SetupBase.Configuration
{
    [Serializable]
	public class XmlAttribute
    {
        private string _value;

		[XmlAttribute()]
		public string Name { get; set; }
		
        [XmlAttribute()]
		public string Description { get; set; }
		
        [XmlAttribute()]
		public string Value 
        { 
            get
            {
                return _value;
            }
            set
            {
                if (!string.IsNullOrEmpty(_value) && value != _value)
                    HasChanges = true;

                _value = value;
            }
        }

        [XmlAttribute()]
        public bool HasChanges { get; set; }
		
        [XmlAttribute()]
		public XmlTagType Type { get; set; }
		
        [XmlAttribute()]
		public bool IsRequired { get; set; }
		
        [XmlAttribute()]
		public bool IsEncrypted { get; set; }
		
        [XmlAttribute()]
		public CryptographyAlgorithm EncryptionAlgorithm { get; set; }

        [XmlAttribute()]
        public string AlgorithmPublicKey { get; set; }        

		public XmlAttribute()
		{
			IsRequired = true;
		}
    }
}
